<template>
  <a-modal v-model="visible"   :title=title :width="1200"  @cancel='cancel'  footer='' >
    <a-table
      :row-key="record => record.xfjbh"
      ref="table"
      size="middle"
      bordered
      :scroll="{ x: 1800}"
      :columns="columns"
      :dataSource="dataSource"
      :pagination="ipagination"
      @change="handleTableChange"
      :loading="loading"
    >

    </a-table>
  </a-modal>
</template>

<script>

import HandleTemporaryService from "@/myService/HandleTemporaryService";
export default {
  data(){
    return{
      visible:false,
      title:'预处理信息',
      // 查询参数
      queryParam: {
        id:null,
        pageSize: 10,
        pageIndex:1,
      },
      /* 数据源 */
      dataSource:[],
      /* 分页参数 */
      ipagination:{
        current: 1,
        pageSize: 10,
        pageSizeOptions: ['10', '20', '30'],
        showTotal: (total, range) => {
          return range[0] + "-" + range[1] + " 共" + total + "条"
        },
        showQuickJumper: true,
        showSizeChanger: true,
        total: 0
      },
      // 表头
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 80,
          align: 'center',
          customRender: (text, row, index) => <span>{this.ipagination.pageSize * (this.ipagination.current - 1) + index + 1}</span>
        },
        {
          title: '信访事项编号',
          align:'center',
          width: 150,
          dataIndex: 'xfjbh',
          ellipsis: true,
        },
        {
          title: '是否流转',
          width: 80,
          dataIndex: 'sflz',
          align: 'center',
          ellipsis: true,
        },
        {
          title: '评价情况',
          dataIndex: 'pjqk',
          align: 'center',
          ellipsis: true,
        },
        {
          title: '姓名',
          align:'center',
          dataIndex: 'xm',
          ellipsis: true,
        },
        {
          title: '问题属地',
          dataIndex: 'wtsd',
          ellipsis: true,
        },
        {
          title: '去向单位',
          width: 150,
          align: "center",
          dataIndex: 'qxdw',
          ellipsis: true,
        },
        {
          title: '内容分类',
          align:'center',
          dataIndex: 'nrfl',
          ellipsis: true,
        },
        {
          title: '初重件',
          align:'center',
          dataIndex: 'scxfbz',
          ellipsis: true,
          customRender: (text, row, index) => <span>{row.scxfbz===1?'初件':'重件'}</span>
        },
        {
          title: '单位满意度',
          align:'center',
          dataIndex: 'zrdwmyd',
          ellipsis: true,
        },
        {
          title: '登记时间',
          align:'center',
          dataIndex: 'djsj',
          ellipsis: true,
          width: 150,
        },
        {
          title: '反应内容',
          dataIndex: 'fynr',
          ellipsis: true,
        },
        {
          title: '登记单位',
          align:'center',
          dataIndex: 'djdw',
          ellipsis: true,
        },
        {
          title: '来电号码',
          align:'center',
          dataIndex: 'ldhm',
          ellipsis: true,
        },
        {
          title: '信访形式',
          align:'center',
          dataIndex: 'xfxs',
          ellipsis: true,
        },
        {
          title: '答复内容',
          dataIndex: 'clqk',
          ellipsis: true,
        },
        {
          title: '信访目的',
          width: 80,
          dataIndex: 'xfmd',
          align: 'center',
          ellipsis: true,
        },
      ],
      /* table加载状态 */
      loading:false,
    }
  },
  methods:{
    open(id){
      this.queryParam.id=id;
      console.log(this.queryParam);
      this.ipagination.current=1;
      this.ipagination.pageSize=10;
      this.visible=true;
      this.loadData();
    },
    loadData(){
      this.dataSource=[];
      this.loading=true;
      this.queryParam.pageIndex=this.ipagination.current;
      this.queryParam.pageSize=this.ipagination.pageSize;
      HandleTemporaryService.getTemporaryOrder(this.queryParam).then(res=>{
        if (res.success) {
          this.dataSource = res.result.records||res.result;
          if(res.result.total)
          {
            this.ipagination.total = res.result.total;
          }else{
            this.ipagination.total = 0;
          }
        }else{
          this.$message.warning(res.message)
        }
      }).finally(()=>{
        this.loading=false;
      })
    },
    cancel(){
      this.visible=false;
    },
    handleTableChange(pagination){
      this.ipagination.current = pagination.current;
      this.ipagination.pageSize = pagination.pageSize;
      this.loadData();
    },
  }
}
</script>

<style scoped>

</style>